//
//  UIView+InterceptTouchEvent.m
//  KeepAccount
//
//  Created by Veer on 2018/1/8.
//  Copyright © 2018年 Veer. All rights reserved.
//

#import "UIView+InterceptTouchEvent.h"

#import <objc/runtime.h>

@implementation UIView (InterceptTouchEvent)


//+ (void)load{
//    //获取着两个方法
//    Method systemMethod = class_getInstanceMethod(self, @selector(touchesBegan:withEvent:));
//    SEL sysSEL = @selector(touchesBegan:withEvent:);
//    
//    Method myMethod = class_getInstanceMethod(self, @selector(myTouchesBegan:withEvent:));
//    SEL mySEL = @selector(myTouchesBegan:withEvent:);
//    
//    //添加方法进去
//    BOOL didAddMethod = class_addMethod(self, sysSEL, method_getImplementation(myMethod), method_getTypeEncoding(myMethod));
//    
//    //如果方法已经存在了
//    if (didAddMethod) {
//        class_replaceMethod(self, mySEL, method_getImplementation(systemMethod), method_getTypeEncoding(systemMethod));
//    }else{
//        method_exchangeImplementations(systemMethod, myMethod);
//        
//    }
//    
//    //----------------以上主要是实现两个方法的互换,load是gcd的只shareinstance，果断保证执行一次
//    
//}

- (void)myTouchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    NSLog(@"%s", __FUNCTION__);
    
//    [self myTouchesBegan:touches withEvent:event];
}


@end
